﻿using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace RulesOfAcquisition
{
	public class ItemViewModel : INotifyPropertyChanged
	{
		private int _number;
		public int Number
		{
			get
			{
				return _number;
			}
			set
			{
				if (value != _number)
				{
					_number = value;
					NotifyPropertyChanged("Number");
				}
			}
		}

		private string _description;
		public string Description
		{
			get
			{
				return _description;
			}
			set
			{
				if (value != _description)
				{
					_description = value;
					NotifyPropertyChanged("Description");
				}
			}
		}

		private string _fullDescription;
		public string FullDescription
		{
			get
			{
				return _number + ". " + _description;
			}
			set
			{
				if (value != _fullDescription)
				{
					_fullDescription = value;
					NotifyPropertyChanged("FullDescription");
				}
			}
		}

		private string _backgroundColor;
		public string BackgroundColor
		{
			get
			{
				int index = App.ViewModel.Items.IndexOf(this);

				if (index % 2 == 0)
				{
					return "DarkGoldenrod";
				}

				return "Goldenrod";
			}
			set
			{
				if (value != _backgroundColor)
				{
					_backgroundColor = value;
					NotifyPropertyChanged("BackgroundColor");
				}
			}
		}

		public event PropertyChangedEventHandler PropertyChanged;
		private void NotifyPropertyChanged(String propertyName)
		{
			PropertyChangedEventHandler handler = PropertyChanged;
			if (null != handler)
			{
				handler(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
}